#ifndef CENTRALCONTROLLER_H
#define CENTRALCONTROLLER_H
#include "Message.h"
#include"MessageTypes.h"
#include "..\DataManipulator\datamanipulator.h"
#include <QUndoStack>
#include <QUndoCommand>
#include "command.h"
#include "..\Translator\translator.h"
#include "..\Serializer\xmlmanager.h"
#include "controller_global.h"

class CONTROLLER_EXPORT centralController:public QObject
{
Q_OBJECT
private:
    QUndoStack* UndoStack;
    QVector<int>* currentEditIndex;
    //DataManipulator* dataManipulator;
    XMLManager* xmlManager;
    //IFileManipulator* fileManipulator;
    Translator* translator;
	DataManipulator* dataManipulator;
    nodePath currentContainerNodePath;
public:
    centralController();
    ~centralController();
	
    void receiveMessage(Message* msg);
	QVector<int> ObjectIndexUnderPointAt(QPointF pt);
	const DisplayNode* GetObjectByIndex(int index);
	const DisplayNode* GetObjectByPath(nodePath path);
	QImage GetObjectImageByIndex(int index);
	QImage GetCurrentContainerImage();
	eNodeType GetNodeType(int index);
	int NumberOfObjects();
	int PointIndexAt(int objectIndex,double x,double y);
	const QPointF GetLControlPoint(int objectIndex,int index);
	const QPointF GetRControlPoint(int objectIndex,int index);
	bool ExistAvaliableProject();
	double CurrentContainerImageOffX();
	double CurrentContainerImageOffY();
	double ImageOffsetX(int index);
	double ImageOffsetY(int index);
	double GetValueByIndex(int index,propertyType type,int time=0);
	Ease::EaseType	GetNodePropertyEaseByIndex(int index,propertyType pt,int time=0);
	QVector<int> GetPropertyKeyFramesTime(propertyType type,int index=-1);
	QString getNodeName(int index=-1);
    void removeKeyFrames(propertyType type,int time);
	bool addNode(int index);
	int sceneW();
	int sceneH();
	//QVector<QPointF> PointsInPath();
signals:
	void refreshTree(nodePath containerPath);
};

#endif // CENTRALCONTROLLER_H
